#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cstring>
typedef long long ll;
using namespace std;
const ll MAXN=1e5+7;
ll a[MAXN], a_cnt;
ll b[MAXN], b_cnt;
int main() {
	ll x1,x2;
//	freopen("in1.txt", "r", stdin);
	ll n;
	cin.sync_with_stdio(false);
	bool flag1,flag2;
	while (cin>>x1>>x2) {
		memset(a,-1,sizeof(a));
		memset(b,-1,sizeof(b));
		if (x1>x2) {
			swap(x1,x2);
			cin>>b_cnt;
			for (ll i=0; i<b_cnt; ++i) cin>>b[i];
			cin>>a_cnt;
			for (ll i=0; i<a_cnt; ++i) cin>>a[i];
		}
		else {
			cin>>a_cnt;
			for (ll i=0; i<a_cnt; ++i) cin>>a[i];
			cin>>b_cnt;
			for (ll i=0; i<b_cnt; ++i) cin>>b[i];
		}
		ll a1=(a_cnt==0? 0 : a[0]);
		ll b1=(b_cnt==0? 0 : b[0]);
		ll st=min(a1, b1);
		a1=(a_cnt==0? 0 : a[a_cnt-1]);
		b1=(b_cnt==0? 0 : b[b_cnt-1]);
		ll en=max(a1, b1);
		ll dis1=x1+4;
		ll dis2=x2;
		ll st1=0, st2=0;
		bool flag1=false, flag2=false;
		for (; st<=en; ++st) {
			if (st==a[st1]) {
				flag1=(!flag1);
				++st1;
			}
			if (st==b[st2]) {
				flag2=(!flag2);
				++st2;
			}
			if (dis1==dis2) {
				break;
			}
			if (flag1) ++dis1;
			if (flag2) ++dis2;
		}
		if(dis1==dis2) {
			cout<<"bumper tap at time "<<st<<endl;
//			printf("bumper tap at time %I64d\n", st);
		}
		else if (a_cnt%2==1 && b_cnt%2==0) {
//			cout<<dis2<<" "<<dis1<<endl;
//			printf("bumper tap at time %I64d\n", dis2-dis1+st);
			cout<<"bumper tap at time "<<dis2-dis1+st<<endl; 
//			cout<<"haha"<<endl; 
		}
		else {
//			printf("safe and sound\n");
			cout<<"safe and sound"<<endl;
		}
	}
	return 0;
}
